package org.nocturne.service;
/**
 * Created with IntelliJ IDEA.
 * User: nocturne
 * Date: 22.04.13
 * Time: 22:22
 * To change this template use File | Settings | File Templates.
 *
 * pom.xml
 * web.xml
 *
 */
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServlet;

public class ServiceServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        // Параметр
        String one = request.getParameter("one");
        String two = request.getParameter("two");

        // Старт HTTP сессии
        HttpSession session = request.getSession(true);
        session.setAttribute("one", one);
        session.setAttribute("two", two);

        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        try {
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Service Servlet</title>");
            out.println("</head>");
            out.println("<body>");
            out.println("<h1>Service servlet</h1>");
            out.println("one = " + one);
            out.println("two = " + two);
            out.println("</body>");
            out.println("</html>");
        } finally {
            out.close();
        }
    }


}